<template>
  <div>
    <!-- .slice((currentPage-1)*pagesize, currentPage*pagesize) -->
    <el-table :header-cell-style="{background:'#EEF3FC',color:'#333333'}" :data="list"  highlight-current-row style="width: 100%">
      <el-table-column
        label="序号"
        type="index"
        style="width: 8%"
        align="center">
      </el-table-column>
      <el-table-column style="width: 12%" align="center" label="机构名称">
        <template slot-scope="scope">
          <span>{{ scope.row.firmName }}</span>
        </template>
      </el-table-column>

      <el-table-column style="width: 12%" align="center" label="法定代表人">
        <template slot-scope="scope">
          <span>{{ scope.row.firmUser }}</span>
        </template>
      </el-table-column>
      <el-table-column style="width: 12%" align="center" label="机构类型">
        <template slot-scope="scope">
          <span>{{ scope.row.trainingScope }}</span>
        </template>
      </el-table-column>
      <el-table-column style="width: 12%" align="center" label="提交时间">
        <template slot-scope="scope">
          <span>{{ scope.row.createTime }}</span>
        </template>
      </el-table-column>

      <el-table-column style="width: 12%" align="center" label="操作">
        <template slot-scope="scope">
          <el-button type="text"  @click="urlTeacherDetail(scope.row)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination class="pagination-a" background layout="prev, pager, next" :total=list.length @current-change="current_change">
    </el-pagination>
  </div>
</template>

<script>
import * as api from "@/api/reportList/reportList.js"
  export default {

    filters: {
      statusFilter(status) {
        const statusMap = {
          published: 'success',
          draft: 'info',
          deleted: 'danger'
        }
        return statusMap[status]
      }
    },

    props: {
      type: {
        type: String,
        default: 'D'
      },
      updateStatus:{
        type:Number,
        default:0
      }
    },
    data() {
      return {
        list: [],
        isShow:'D',
        listQuery: {
          page: 1,
          limit: 5,
          type: this.type,
          sort: '+id'
        },
        pagesize:10,
        currentPage:1,
      }
    },
    created() {
      // this.getList()
       // 获取有待审批 相关数据
      this.getSysFirmList()
    },
    methods: {
      // 获取有待 或完成审批列表
      getSysFirmList(){
          this.$http({
          url: this.$http.adornUrl('/sys/firm/firmList?updateStatus='+this.updateStatus+'&limit='+this.pagesize+'&page='+this.currentPage
          ),
          method: 'post',
          data:{}
        }).then(res=>{
          if(res.data.code==0){
            this.list=res.data.page.list
          }
        })
      },
      // 跳转详情
      urlTeacherDetail(row){
        console.log('跳转详情了')
        this.$router.push({ name: 'message', params: {id:'teacher',name:row.firmName,userId:row.userId,updateStatus:this.updateStatus} })
      },
      // getList() {
      //   this.loading = true::
      //   this.isShow = this.listQuery.type
      // },
      open() {
        this.$alert('<strong>机构内容从法理基础来讲，教育培训机构享有的权利属于社会教育权，其存在具有一定的法理基础，教育培训机构在民法中是“特殊企业法人”，其公益属性是不同于一般企业法人最显著的特征；在行政法中是“行政相对人”，与政府构成行政法律关系。归属于社会教育权范畴的教育培训机构，相对于国家教育权而言，具有独特的法律属性。</strong>', '未通过原因', {
          dangerouslyUseHTMLString: true
        });
      },
      current_change:function(currentPage){
        this.currentPage = currentPage;
      },
    }
  }
</script>

